#include<iostream>
#include<vector>
#include<string>
using namespace std;

class Person{
public:
    Person(){
        cout<<"Person()"<<endl;
    }

    ~Person(){
        cout<<"~Person()"<<endl;
    }
    
    void Print(){
        cout<<"age:"<<_age<<endl;
        cout<<"name:"<<_name<<endl;
    }

    void func(){
        cout<<"Person:func()"<<endl;
    }


    int _age=0;
    string _name="zhangsan";
};

class Student:virtual public Person{
public:
    Student(){
        cout<<"Student()"<<endl;
    }

    ~Student(){
        cout<<"~Student()"<<endl;
    }

    void func(){
        cout<<"Student:func()"<<endl;
    }
private:
    int _num1=1;
};

class Teacher:virtual public Person{
private:
    int _num2=0;
};

class Assistant:public Student,public Teacher{
private:
    string _majorcourse;

};

class A
{
public :
    A () {++ _count ;}
protected :
    int _a ; 
public :
    static int _count; // 统计个数。
};
int A :: _count = 0;
class B : public A
{
protected :
    int _b ; 
};
class C : public B
{
protected :
    int _c ; 
};
void test()
{
    B s1 ;
    B s2 ;
    B s3 ;
    C s4 ;
    cout <<"count:"<< A ::_count << endl;
    B ::_count = 0;
    cout <<"count:"<< A ::_count << endl;
}

void test1(){
    Student s;
    Teacher t;
    s.Print();
    t.Print();
}

void test2(){
    Student sobj;
    //派生类对象可以赋值给基类
    Person pobj=sobj;   //对象赋值
    Person* pp=&sobj;//指针赋值
    Person& rp=sobj; //引用赋值

    //基类对象不可以赋值给派生类
    //sobj=pobj;

    //基类对象的指针可以强制类型转换赋值给派生类指针
    //pp=&sobj;
    //Student* ps1=(Student*)pp;


}

void test3(){
    Student s;
    s.func();
    s.Person::func();
}

void test4(){
    Assistant a;
    //cout<<a.Student::_name<<endl;
}

int main(){
    //test1();
    //test2();
    //test3();
    test4();
    //test();

    return 0;
}